<?php

namespace app\common\model;

use think\Model;

class IntegralLog extends Model
{
    protected $append = [
      
        'nickname',
        
    ];
    public function getNicknameAttr($value){
        if($this->User){
            return $this->User->getData('nickname');
        }else{
            return '';
        }
    }
    public function User()
    {
        return $this->belongsTo('User', 'userid', 'id');
    }

    public function getTypeAttr($value)
    {

        $status = [

            1=>'余额兑换扣除',2=>'签到获得',3=>'余额兑换失败返还',4=>'抽奖获得'

        ];
        return $status[$value];
    }
    
}
